// 权限接口
import instance from '@/utils/request'

// 获取所有权限
export function getAllPermissionApi () {
  return instance({
    url: '/sys/permission',
    method: 'get'
  })
}

// 根据id获取权限
export function getPermissionByIdApi (id) {
  return instance({
    url: `/sys/permission/${id}`,
    method: 'get'
  })
}

// 根据id修改权限
export function editPermissionByIdApi (data) {
    return instance({
      url: `/sys/permission/${data.id}`,
      method: 'put',
      data
    })
  }

  // 根据id删除权限
export function delPermissionByIdApi (id) {
    return instance({
        url: `/sys/permission/${id}`,
        method: 'delete',
      })
  }

  // 添加权限
export function addPermissionApi (data) {
    return instance({
      url: '/sys/permission',
      method: 'post',
      data
    })
  }